home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
c't freeware shareware 1999 February
/
CT_SW9902.ISO
/
mac
/
software
/
wissen
/
daten
/
gnuplot.hqx
/
gnuplot.2.0b4
/
Interapplication
/
C Examples
/
gnuplot interface test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-27
|
1KB
|
48 lines
#include <Types.h>
#include <Files.h>
#include <QuickDraw.h>
#include <Windows.h>
#include <Dialogs.h>
#include <StandardFile.h>
#include "gnuplotInterface.h"
#include <stdio.h>
#include <string.h>
char testData[] = "1 1\r2 2\r3 3\r4 4\r5 5\r6 6\r7 7\r8 8\r9 8\r10 8\r11 8\r12 8\r13 4\r14 0\r";
void main()
{
char command[] = "plot sin(x)";
SFTypeList typeList = {'TEXT'};
StandardFileReply inputFileRep;
long length, err;
InitGraf(&qd.thePort);
FlushEvents(everyEvent, 0);
InitWindows();
InitMenus();
TEInit();
InitDialogs(NULL);
InitCursor();
MaxApplZone();
// printf("gnuplot / Apple event demo\n");
StandardGetFile(NULL, 1, typeList, &inputFileRep);
GnuplotInitializeObjects();
if (GnuplotLaunchApplicationToFront())
return;
length = strlen(command);
GnuplotExecuteCommand(command, length);
if (inputFileRep.sfGood) {
err = GnuplotPlot(&inputFileRep.sfFile, 1, NULL, 0, 0, 0, gp_type_lines);
err = GnuplotPlot(&inputFileRep.sfFile, 1, testData, strlen(testData), 0, 0, gp_type_lines);
// if(err)
// printf("Apple Event Error - plot 2: %ld\n", err);
err = GnuplotPlot(&inputFileRep.sfFile, 1, NULL, 0, 1, 0, gp_type_boxes);
// if(err)
// printf("Apple Event Error - plot 3: %ld\n", err);
}
GnuplotShutDownObjects();
}